C++: Performance fix for FlowVar.getAnAccess#403
Conversation
The previous formulation of this predicate caused a CP in snapshots where a variable had a large number of definitions and also reached a large number of sub-basic-blocks. This should fix performance of https://github.com/FrodeSolheim/fs-uae and https://github.com/libretro/libretro-uae. The `FlowVar.getAnAccess` predicate is still at risk of CP'ing when a large group of defs has a large group of uses, but that has not been observed to happen in practice yet. We would need to make `localFlowStep` expose phi definitions in order to avoid that risk.
geoffw0
left a comment
There was a problem hiding this comment.
My runs of libretro-uae improve from 1049s to 745s with this change (compared to 1337s a few days ago). I'm happy and will merge this assuming the tests have passed.
If we're looking for further improvements there's still one expensive predicate left of the three I originally mentioned on Slack:
inconsistentLoopDirection.ql-11:FlowVar::FlowVar_internal::AlwaysTrueUponEntryLoop::getARelevantVariable_dispred#ff .. 6m30s
|
@geoffw0 I can't replicate that performance problem. On libretro-uae I get the following, using the latest |
|
That's great, we should keep an eye on the query to confirm though. |
|
For the On |
|
Good catch. I'll take a look. |
|
I should have investigated that problem better when you reported it the first time. The predicate had the shape |
|
With #598 it took just 370s and there are no standout predicates: |
As noted by @geoffw0 in #401, the previous formulation of this predicate caused a CP in snapshots where a variable had a large number of definitions and also reached a large number of sub-basic-blocks.
This should fix performance of https://github.com/FrodeSolheim/fs-uae and https://github.com/libretro/libretro-uae.
The
FlowVar.getAnAccesspredicate is still at risk of CP'ing when a large group of defs has a large group of uses, but that has not been observed to happen in practice yet. We would need to makelocalFlowStepexpose phi definitions in order to avoid that risk.